]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
util: Restore the NOFILE limit before spawning apps
authorOlivier Fourdan <ofourdan@redhat.com>
Wed, 19 Jan 2022 09:15:51 +0000 (10:15 +0100)
committerOlivier Fourdan <ofourdan@redhat.com>
Tue, 8 Feb 2022 08:25:25 +0000 (08:25 +0000)
Make sure the restore the original NOFILE limit prior to run the
commands so those don't inherit from the raised value.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>

js/misc/util.js

index da768566a49b0d2b024082efcae4c7a4add41037..bea2cfe852afff9804b6376a5ccab6fac187e06a 100644 (file)
@@ -111,9 +111,16 @@ function spawnApp(argv) {
 function trySpawn(argv) {
     var success_, pid;
     try {
-        [success_, pid] = GLib.spawn_async(null, argv, null,
-                                           GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
-                                           null);
+        [success_, pid] = GLib.spawn_async(
+            null, argv, null,
+            GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
+            () => {
+                try {
+                    global.context.restore_rlimit_nofile();
+                } catch (err) {
+                }
+            }
+        );
     } catch (err) {
         /* Rewrite the error in case of ENOENT */
         if (err.matches(GLib.SpawnError, GLib.SpawnError.NOENT)) {